send($data); if (isset($response["error"])) { echo "Error: ".$response["error"].""; return false; } return $response; } //echos a list of the protocols that are currently configured on this MistServer instance function getCurrentProtocols() { if ($data = getData(Array("config" => true))) { if ((isset($data["config"])) && (isset($data["config"]["protocols"]))) { //loop over the configured protocols and add the connector type to an output array $protocols = $data["config"]["protocols"]; $output = Array(); foreach ($protocols as $p) { $output[] = $p["connector"]; } //echo output as a string if (count($output)) { echo implode($output,", "); } else { echo "None."; } } else { echo "Error: Couldn't find protocols in the config data"; } } } //echos the last error message, if any exist within the 100 most recent log entries function getLastErrorLog() { if ($data = getData(Array("log" => true))) { if (isset($data["log"])) { $output = false; //loop over the log entries, starting from the most recent one for ($n = count($data["log"])-1; $n >=0; $n--) { $entry = $data["log"][$n]; //check the message type if (($entry[1] == "FAIL") || ($entry[1] == "ERROR")) { $output = "[".date("H:i",$entry[0])."] ".$entry[2]; break; } } if ($output) { echo $output; } else { echo "None."; } } else { echo "Error: Couldn't find logs in the config data"; } } } function addStream($name,$options = Array()) { if ($reply = getData(Array("addstream" => Array($name => $options)))) { if ((isset($reply["streams"])) && (isset($reply["streams"][$name]))) { echo "Stream ".$name." saved."; return $reply["streams"][$name]; } else { echo "Error: Failed to configure stream ".$name.""; return false; } } } function deleteStream($name) { if ($reply = getData(Array("deletestream" => Array($name)))) { if ((isset($reply["streams"])) && (!isset($reply["streams"][$name]))) { echo "Stream ".$name." deleted."; return true; } else { echo "Error: Failed to delete stream ".$name.""; return false; } } } ?>

Protocols currently enabled

Recent error

Stream configuration

"/path/to/file.flv" )); ?>